package com.tyk.bookstore.back.auth.model.query;

import com.tyk.bookstore.back.auth.model.type.CaptchaLoginType;
import com.tyk.bookstore.back.auth.valid.group.EmailValidGroup;
import com.tyk.bookstore.back.auth.valid.group.MobilePhoneValidGroup;
import com.tyk.bookstore.back.auth.valid.provider.CaptchaLoginQueryGroupValidProvider;
import com.tyk.bookstore.back.common.core.valid.annotation.DigitalCaptchaValid;
import com.tyk.bookstore.back.common.core.valid.annotation.EmailValid;
import com.tyk.bookstore.back.common.core.valid.annotation.MobilePhoneValid;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.group.GroupSequenceProvider;

@GroupSequenceProvider(CaptchaLoginQueryGroupValidProvider.class)
@Data
public class CodeLoginQuery {

    @Schema(description = "认证主体: 账号、手机号、邮箱")
    @NotBlank
    @MobilePhoneValid(groups = {MobilePhoneValidGroup.class})
    @EmailValid(groups = {EmailValidGroup.class})
    private String principal;

    @Schema(description = "消息验证码凭证")
    @NotBlank
    private String codeCredential;

    @Schema(description = "验证码")
    @NotBlank
    @DigitalCaptchaValid
    private String credential;

    @Schema(description = "验证码登录表单类型：1手机号、2邮箱", type = "integer")
    @NotNull
    private CaptchaLoginType type;

}
